# -*- coding: utf-8-unix; fill-column: 95; -*-

###############################################################################################
#
# This file is part of Escapade Trip Planner, a social web application for creating and
# sharing motorcycle roadmaps.
#
# Copyright © 2011, Pierre-François Gomez <pef.gomez@gmail.com>
#
# Escapade Trip Planner is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later version.
#
# Escapade Trip Planner is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with Escapade Trip
# Planner. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################################

import multiprocessing

from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4 import QtWebKit

import config

class HTTPClient(multiprocessing.Process):
    def __init__(self, argv):
        super(HTTPClient,  self).__init__()
        self._app = QtGui.QApplication(argv)
        self._view = QtWebKit.QWebView()
        self._host = config.http_service['host']
        self._port = str(config.http_service['port'])

    def run(self):
        self._view.load(QtCore.QUrl("http://" + self._host + ":" + self._port))
        self._view.show()
        self._app.exec_()
